﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Http.Filters;

namespace FServer
{
    public class HttpHeaderAttribute : ActionFilterAttribute
    {
        private string _name;
        private string _value;

        public string Name
        {
            set { _name = value; }
            get { return _name; }
        }

        public string Value
        {
            set { _value = value; }
            get { return _value; }
        }

        public HttpHeaderAttribute(string name, string value)
        {
            _name = name;
            _value = value;
        }

        public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
        {
            actionExecutedContext.Response.Headers.Add(_name, _value);
            base.OnActionExecuted(actionExecutedContext);
        }
    }
}